menubar: Ignore the shadow-type style property
authorMatthias Clasen <mclasen@redhat.com>
Mon, 16 Nov 2015 11:14:54 +0000 (06:14 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 16 Nov 2015 12:20:18 +0000 (07:20 -0500)
The border can be controlled with regular CSS, so deprecate
and ignore this style property.

gtk/gtkmenubar.c

index 6066b2ef37caa343958047a0b732e7e44d5975e3..5155783c11fca1e47a823e889b30c9605de5bac0 100644 (file)
@@ -105,8 +105,6 @@ static gint gtk_menu_bar_get_popup_delay   (GtkMenuShell    *menu_shell);
 static void gtk_menu_bar_move_current      (GtkMenuShell     *menu_shell,
                                             GtkMenuDirectionType direction);
 
-static GtkShadowType get_shadow_type   (GtkMenuBar      *menubar);
-
 G_DEFINE_TYPE_WITH_PRIVATE (GtkMenuBar, gtk_menu_bar, GTK_TYPE_MENU_SHELL)
 
 static void
@@ -214,6 +212,14 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
                                                       GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
   
 
+  /**
+   * GtkMenuBar:shadow-type:
+   *
+   * The style of the shadow around the menubar.
+   *
+   * Deprecated: 3.20: Use CSS to determine the shadow; the value of
+   *     this style property is ignored.
+   */
   gtk_widget_class_install_style_property (widget_class,
                                           g_param_spec_enum ("shadow-type",
                                                               P_("Shadow type"),
@@ -398,20 +404,17 @@ gtk_menu_bar_size_request (GtkWidget      *widget,
   *minimum += border_width * 2;
   *natural += border_width * 2;
 
-  if (get_shadow_type (menu_bar) != GTK_SHADOW_NONE)
-    {
-      gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+  gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
 
-      if (orientation == GTK_ORIENTATION_HORIZONTAL)
-        {
-          *minimum += border.left + border.right;
-          *natural += border.left + border.right;
-        }
-      else
-        {
-          *minimum += border.top + border.bottom;
-          *natural += border.top + border.bottom;
-        }
+  if (orientation == GTK_ORIENTATION_HORIZONTAL)
+    {
+      *minimum += border.left + border.right;
+      *natural += border.left + border.right;
+    }
+  else
+    {
+      *minimum += border.top + border.bottom;
+      *natural += border.top + border.bottom;
     }
 }
 
@@ -495,16 +498,13 @@ gtk_menu_bar_size_allocate (GtkWidget     *widget,
       remaining_space.height = allocation->height -
         2 * border_width - border.top - border.bottom;
 
-      if (get_shadow_type (menu_bar) != GTK_SHADOW_NONE)
-       {
-          gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+      gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+
+      remaining_space.x += border.left;
+      remaining_space.y += border.top;
+      remaining_space.width -= border.left + border.right;
+      remaining_space.height -= border.top + border.bottom;
 
-          remaining_space.x += border.left;
-          remaining_space.y += border.top;
-          remaining_space.width -= border.left + border.right;
-          remaining_space.height -= border.top + border.bottom;
-       }
-      
       requested_sizes = g_array_new (FALSE, FALSE, sizeof (GtkRequestedSize));
 
       if (priv->pack_direction == GTK_PACK_DIRECTION_LTR ||
@@ -636,11 +636,10 @@ gtk_menu_bar_draw (GtkWidget *widget,
                          gtk_widget_get_allocated_width (widget) - border * 2,
                          gtk_widget_get_allocated_height (widget) - border * 2);
 
-  if (get_shadow_type (GTK_MENU_BAR (widget)) != GTK_SHADOW_NONE)
-    gtk_render_frame (context, cr,
-                      border, border,
-                      gtk_widget_get_allocated_width (widget) - border * 2,
-                      gtk_widget_get_allocated_height (widget) - border * 2);
+  gtk_render_frame (context, cr,
+                    border, border,
+                    gtk_widget_get_allocated_width (widget) - border * 2,
+                    gtk_widget_get_allocated_height (widget) - border * 2);
 
   GTK_WIDGET_CLASS (gtk_menu_bar_parent_class)->draw (widget, cr);
 
@@ -770,18 +769,6 @@ _gtk_menu_bar_cycle_focus (GtkMenuBar       *menubar,
     g_signal_emit_by_name (to_activate, "activate_item");
 }
 
-static GtkShadowType
-get_shadow_type (GtkMenuBar *menubar)
-{
-  GtkShadowType shadow_type = GTK_SHADOW_OUT;
-  
-  gtk_widget_style_get (GTK_WIDGET (menubar),
-                       "shadow-type", &shadow_type,
-                       NULL);
-
-  return shadow_type;
-}
-
 static gint
 gtk_menu_bar_get_popup_delay (GtkMenuShell *menu_shell)
 {